﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;

namespace Xyz.Web.Reservation.Models
{
    public class ExpiryDateAttribute: ValidationAttribute
    {
        public override bool IsValid(object value)
        {
            if (value == null)
            {
                return true;
            }
            
            DateTime ExpiryDate = DateTime.Now.AddMonths(3);
            DateTime pasDate = (DateTime)value;

            if (ExpiryDate.CompareTo(pasDate) > 0)
                return false;

            return true;
        }
    }
}